package com.cssl.controller;

import com.cssl.pojo.Goods;
import com.cssl.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @GetMapping("/index_findAll")
    public List<Goods> findAll(){
        return goodsService.index_findAll();
    }
    @GetMapping("/index_findByType")
    public List<Goods> findByType(@RequestParam("t_id") Integer t_id){
        System.out.println("findByType:"+t_id);
        return goodsService.index_findByType(t_id);
    }
    @GetMapping("/index_findById")
    public Goods findById(Integer gid){
        return goodsService.index_findById(gid);
    }
    @GetMapping("/shop_mainserch")
    public List<Goods> findById(@RequestParam Map<String,Object> map){
        return goodsService.shop_mainserch(map);
    }
    @GetMapping("/shop_changeOrder")
    public List<Goods> changeOrder(@RequestParam String order){
        return goodsService.shop_changeOrder(order);
    }
}
